package com.roomwrod;

import android.content.Context;

import com.roomwrod.db.WordDao;
import com.roomwrod.model.Word;

import javax.crypto.interfaces.PBEKey;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

@Database(entities = {Word.class}, version = 1, exportSchema = false)
public abstract class AppDataBase extends RoomDatabase {
    private static AppDataBase INSTANCE;
    public abstract WordDao getWordDao();

    public static synchronized AppDataBase getInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = Room.databaseBuilder(context, AppDataBase.class, "words-data")
                    .allowMainThreadQueries()
                    .build();
        }
        return INSTANCE;
    }

}
